home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 19 / Amiga Plus Leser CD 19.iso / Online / AmigaTalk / intuition / GadgetTypes.st < prev    next >
Text File  |  2002-03-15  |  3KB  |  84 lines

  1. " -------------------------------------------------------------------- "
  2. " GadgetTypes Class is a Singleton class that allows the user to       "
  3. " reference Gadget Types without having to remember their actual       "
  4. " hexadecimal values.                                                  "
  5. ""
  6. " The User does NOT need to create one of these, since Intuition Class "
  7. " will instantiate the only needed instance of this Class.  See the    "
  8. " SetupIntuition.st source file for the method(s) that help the User   "
  9. " with this Class.                                                     "
  10. ""
  11. "   EXAMPLE:  'myTag <- intuition getGadgetType: #GTYP_BOOLGADGET'     "
  12. ""
  13. " ALL singleton classes MUST contain the following:                    "
  14. ""
  15. "   the methods:  isSingleton AND privateSetup     AND                 "
  16. "                 uniqueInstance Class instance variable.              "
  17. " -------------------------------------------------------------------- "
  18.  
  19. Class GadgetTypes :Dictionary ! uniqueInstance !
  20. [
  21.    isSingleton
  22.      ^ true  
  23. |  
  24.    privateNew ! newinstance !
  25.      newinstance <- super new.
  26.  
  27.      ^ newinstance
  28. |
  29.    new
  30.      ^ (self privateSetup)
  31. |
  32.    privateSetup
  33.      (uniqueInstance isNil)
  34.        ifTrue: [uniqueInstance <- self privateNew.
  35.  
  36.                 self at: #GTYP_GTYPEMASK    put: 7.  "2r0111 For masking."
  37.  
  38.                 self at: #GTYP_BOOLGADGET   put: 1.
  39.                 self at: #GTYP_GADGET0002   put: 2.
  40.                 self at: #GTYP_PROPGADGET   put: 3.
  41.                 self at: #GTYP_STRGADGET    put: 4.
  42.                 self at: #GTYP_CUSTOMGADGET put: 5.
  43.  
  44.                 self at: #GTYP_SYSTYPEMASK  put: 16r00F0. "For masking."
  45.                 self at: #GTYP_SIZING       put: 16r0010.
  46.                 self at: #GTYP_WDRAGGING    put: 16r0020.
  47.                 self at: #GTYP_SDRAGGING    put: 16r0030.
  48.                 self at: #GTYP_WDEPTH       put: 16r0040.
  49.                 self at: #GTYP_SDEPTH       put: 16r0050.
  50.                 self at: #GTYP_WZOOM        put: 16r0060.
  51.                 self at: #GTYP_SUNUSED      put: 16r0070.
  52.                 self at: #GTYP_CLOSE        put: 16r0080.
  53.  
  54.                 "All Gadget Global Type flags (padded): "
  55.  
  56.                 self at: #GTYP_GADGETTYPE   put: 16rFC00. 
  57.  
  58.                 self at: #GTYP_REQGADGET    put: 16r1000.
  59.                 self at: #GTYP_GZZGADGET    put: 16r2000.
  60.                 self at: #GTYP_SCRGADGET    put: 16r4000.
  61.                 self at: #GTYP_SYSGADGET    put: 16r8000.
  62.  
  63.                 "GadTools uses a lot of different types:"
  64.                 self at: #GENERIC_KIND      put: 0.
  65.                 self at: #BUTTON_KIND        put: 1.
  66.                 self at: #CHECKBOX_KIND        put: 2.
  67.                 self at: #INTEGER_KIND        put: 3.
  68.                 self at: #LISTVIEW_KIND        put: 4.
  69.                 self at: #MX_KIND           put: 5.
  70.                 self at: #NUMBER_KIND        put: 6.
  71.                 self at: #CYCLE_KIND        put: 7.
  72.                 self at: #PALETTE_KIND        put: 8.
  73.                 self at: #SCROLLER_KIND        put: 9.
  74.  
  75.                 "Kind number 10 is reserved."
  76.  
  77.                 self at: #SLIDER_KIND        put: 11.
  78.                 self at: #STRING_KIND        put: 12.
  79.                 self at: #TEXT_KIND        put: 13.
  80.                ].
  81.  
  82.      ^ self "uniqueInstance??"
  83. ]
  84.